<template>
	<view :style="{ height: conentHeight + 'px;' }">
		<view class="top-height">
			<view class="page-top-box">
				<view class="search-box flex ac">
					<u-search
						borderColor="#DADADA"
						bgColor="#ffffff"
						placeholder="搜索项目名称"
						v-model="searchForm.project_name"
						:showAction="false"
						@search="searchFunc"
						@clear="searchFunc"
					></u-search>
					<u-button
						v-if="$isPer(per_arr, ['project_add'])"
						@click="navToAddFunc"
						customStyle="width: 156rpx;height: 64rpx;background: #3B75FF;border-radius: 32rpx;border-color:#F8F8FA;font-weight: 400;font-size: 26rpx;color: #ffffff;margin-left:20rpx;"
						:hairline="false"
						text="新增项目"
					></u-button>
				</view>
			</view>
			<view class="search-tab-box flex ac">
				<view class="tab-width">
					<u-tabs
						:list="searchTabList"
						lineHeight="0"
						inactiveStyle="width: 118rpx;height: 52rpx;background: #F8F8FA;border-radius: 26rpx;font-weight: 400;font-size: 26rpx;color: #919092;line-height:52rpx;text-align:center;"
						activeStyle="width: 118rpx;height: 52rpx;background: #3B75FF;border-radius: 26rpx;font-weight: 500;font-size: 26rpx;color: #FFFFFF;line-height:52rpx;text-align:center;"
						@click="searchTabClick"
						:current="searchForm.display_status_index"
					></u-tabs>
				</view>
				<view class="search-btn flex ac" @click="searchShow = true" :style="searchShow ? 'color:#3B75FF;' : ''">
					筛选
					<text class="iconfont icon-shaixuan" :style="searchShow ? 'color:#3B75FF;' : ''"></text>
				</view>
			</view>
		</view>
		<view class="list-content-box" :style="{ height: 'calc(100% - ' + topHeight + 'px);' }">
			<z-paging
				@onRefresh="refresh"
				ref="paging"
				:fixed="false"
				v-model="dataList"
				@query="queryList"
				:paging-style="{ 'background-color': '#f7f7f7', height: '100%', width: '100%' }"
			>
				<template slot="empty">
					<u-empty icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png" text=" "></u-empty>
				</template>
				<view class="list-items flex ac flex-wrap" :key="index" v-for="(item, index) in dataList" @click.stop="navToDetailFunc(item)">
					<view class="list-items-title flex ac jb" v-if="$fieldShowFunc('xm_xmmc')">
						<view class="title u-line-1">{{ item.project_name }}</view>
					</view>
					<view class="list-items-item flex ac">
						<u-tag
							v-if="$fieldShowFunc('xm_xmpp') && item.brand_name"
							:borderColor="item.brand_colour"
							:bgColor="item.brand_colour"
							:text="item.brand_name"
							size="mini"
						></u-tag>
						<template v-if="$fieldShowFunc('xm_kclx')">
							<u-tag color="#909399" borderColor="rgba(0,0,0,0)" bgColor="#F4F4F5" text="无需勘场" size="mini" v-if="item.survey_site == 1"></u-tag>
							<u-tag color="#3B75FF" borderColor="rgba(0,0,0,0)" bgColor="rgba(59, 117, 255, .15)" text="需要勘场" size="mini" v-if="item.survey_site == 2"></u-tag>
							<u-tag color="#3B75FF" borderColor="rgba(0,0,0,0)" bgColor="rgba(59, 117, 255, .15)" text="勘场出图" size="mini" v-if="item.survey_site == 3"></u-tag>
						</template>
						<!-- 项目进度 -->
						<template v-if="$fieldShowFunc('xm_xmjd')">
							<u-tag bgColor="#175ADC33" color="#175ADC" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 10" text="待启动" size="mini"></u-tag>
							<u-tag bgColor="#e8a35a33" color="#e8a35a" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 15" text="待勘场" size="mini"></u-tag>
							<u-tag bgColor="#bccf2d33" color="#bccf2d" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 18" text="待勘场出图" size="mini"></u-tag>
							<u-tag bgColor="#4F0CCA33" color="#4F0CCA" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 20" text="出图中" size="mini"></u-tag>
							<u-tag bgColor="#D88D9533" color="#D88D95" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 25" text="待报价" size="mini"></u-tag>
							<u-tag bgColor="#8F279B33" color="#8F279B" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 30" text="洽谈中" size="mini"></u-tag>
							<u-tag bgColor="#7D365D33" color="#7D365D" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 40" text="已签约" size="mini"></u-tag>
							<u-tag bgColor="#2b821633" color="#2b8216" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 42" text="待进场" size="mini"></u-tag>
							<u-tag bgColor="#1acfd633" color="#1acfd6" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 45" text="施工中" size="mini"></u-tag>
							<u-tag bgColor="#0078A333" color="#0078A3" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 50" text="已完工" size="mini"></u-tag>
							<u-tag bgColor="#A71B1B33" color="#A71B1B" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 55" text="待结算" size="mini"></u-tag>
							<u-tag bgColor="#60cf2333" color="#60cf23" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 60" text="款项付清" size="mini"></u-tag>
							<u-tag bgColor="#f4f4f5" color="#909399" borderColor="rgba(0,0,0,0)" v-if="item.display_status == 70" text="项目取消" size="mini"></u-tag>
						</template>
					</view>
					<view class="list-items-item flex ac" v-if="$fieldShowFunc('xm_xmlx')">
						<view class="title">项目类型</view>
						<view class="desc u-line-1">{{ item.store_type_name || '--' }}</view>
					</view>
					<view class="list-items-item flex ac" v-if="$fieldShowFunc('xm_khmc')">
						<view class="title">客户名称</view>
						<view class="desc u-line-1">{{ item.user_name || '--' }}</view>
					</view>
					<view class="list-items-item flex ac" v-if="$fieldShowFunc('xm_sggcjl')">
						<view class="title">施工工程经理</view>
						<view class="desc u-line-1">{{ item.engineering_manager_name || '--' }}</view>
					</view>
					<!-- 按钮 -->
					<view style="width: 100%">
						<judgeBtn plain :per_arr="per_arr" :btns="btns" objectType="project" :state="item.status" :item="item" @change="btnsChange"></judgeBtn>
					</view>
				</view>
			</z-paging>
		</view>
		<!-- 筛选弹窗 -->
		<u-popup :show="searchShow" round="30" @close="searchShow = false" closeable>
			<view class="search-popup-title">全部筛选</view>
			<scroll-view scroll-y class="search-popup-box">
				<view class="search-items">
					<view class="search-items-title">项目编号</view>
					<u--input placeholder="请输入内容" border="surround" v-model="searchForm.project_number"></u--input>
				</view>
				<view class="search-items">
					<view class="search-items-title flex ac jb">
						<text>项目品牌</text>
						<view class="search-items-title-right flex ac jc" hover-class="hover-class" v-if="searchListObj.brand_id.page != 1" @click="retractFunc('brand_id')">
							<text class="txt">收起</text>
							<u-icon name="arrow-up" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
					<view class="search-items-list flex ac flex-wrap">
						<view
							@click="searchSelectFunc('brand_id', item)"
							class="search-items-list-item u-line-1"
							:class="item.id == searchForm.brand_id ? 'search-items-list-item-active' : ''"
							hover-class="hover-class"
							v-for="(item, index) in searchListObj.brand_id.list"
							:key="index"
						>
							{{ item.name }}
						</view>
						<view
							class="search-items-list-more flex ac jc"
							hover-class="hover-class"
							@click="lookMoreFunc('brand_id')"
							v-if="searchListObj.brand_id.max != searchListObj.brand_id.list.length"
						>
							<text class="txt">查看更多</text>
							<u-icon name="arrow-down" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
				</view>
				<view class="search-items">
					<view class="search-items-title flex ac jb">
						<text>项目进度</text>
						<view
							class="search-items-title-right flex ac jc"
							hover-class="hover-class"
							v-if="searchListObj.display_status.num != 5"
							@click="retractFunc('display_status')"
						>
							<text class="txt">收起</text>
							<u-icon name="arrow-up" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
					<view class="search-items-list flex ac flex-wrap">
						<template v-for="(item, index) in searchListObj.display_status.list">
							<view
								@click="searchSelectFunc('display_status', item)"
								v-if="index < searchListObj.display_status.num"
								class="search-items-list-item"
								:class="searchForm.display_status.indexOf(item.value) != -1 ? 'search-items-list-item-active' : ''"
								hover-class="hover-class"
								:key="index"
							>
								{{ item.label }}
							</view>
						</template>
						<view
							class="search-items-list-more flex ac jc"
							hover-class="hover-class"
							v-if="searchListObj.display_status.num == 5"
							@click="lookMoreFunc('display_status')"
						>
							<text class="txt">查看更多</text>
							<u-icon name="arrow-down" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
				</view>
				<view class="search-items">
					<view class="search-items-title flex ac jb">
						<text>项目类型</text>
						<view
							class="search-items-title-right flex ac jc"
							hover-class="hover-class"
							v-if="searchListObj.store_type_id.page != 1"
							@click="retractFunc('store_type_id')"
						>
							<text class="txt">收起</text>
							<u-icon name="arrow-up" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
					<view class="search-items-list flex ac flex-wrap">
						<view
							@click="searchSelectFunc('store_type_id', item)"
							class="search-items-list-item"
							:class="item.id == searchForm.store_type_id ? 'search-items-list-item-active' : ''"
							hover-class="hover-class"
							v-for="(item, index) in searchListObj.store_type_id.list"
							:key="index"
						>
							{{ item.store_type_name }}
						</view>
						<view
							class="search-items-list-more flex ac jc"
							hover-class="hover-class"
							@click="lookMoreFunc('store_type_id')"
							v-if="searchListObj.store_type_id.list.length != searchListObj.store_type_id.max"
						>
							<text class="txt">查看更多</text>
							<u-icon name="arrow-down" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
				</view>
				<view class="search-items">
					<view class="search-items-title flex ac jb">
						<text>客户姓名</text>
						<view class="search-items-title-right flex ac jc" hover-class="hover-class" v-if="searchListObj.user_name.page != 1" @click="retractFunc('user_name')">
							<text class="txt">收起</text>
							<u-icon name="arrow-up" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
					<view class="search-items-list flex ac flex-wrap">
						<view
							@click="searchSelectFunc('user_name', item)"
							class="search-items-list-item"
							:class="searchForm.user_id == item.id ? 'search-items-list-item-active' : ''"
							hover-class="hover-class"
							v-for="(item, index) in searchListObj.user_name.list"
							:key="index"
						>
							{{ item.name }}
						</view>
						<view
							class="search-items-list-more flex ac jc"
							hover-class="hover-class"
							@click="lookMoreFunc('user_name')"
							v-if="searchListObj.user_name.list.length != searchListObj.user_name.max"
						>
							<text class="txt">查看更多</text>
							<u-icon name="arrow-down" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
				</view>
				<view class="search-items">
					<view class="search-items-title flex ac jb">
						<text>施工工程经理</text>
						<view
							class="search-items-title-right flex ac jc"
							hover-class="hover-class"
							v-if="searchListObj.engineering_manager_id.page != 1"
							@click="retractFunc('engineering_manager_id')"
						>
							<text class="txt">收起</text>
							<u-icon name="arrow-up" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
					<view class="search-items-list flex ac flex-wrap">
						<view
							@click="searchSelectFunc('engineering_manager_id', item)"
							class="search-items-list-item"
							:class="searchForm.engineering_manager_id == item.id ? 'search-items-list-item-active' : ''"
							hover-class="hover-class"
							v-for="(item, index) in searchListObj.engineering_manager_id.list"
							:key="index"
						>
							{{ item.name }}
						</view>
						<view
							class="search-items-list-more flex ac jc"
							hover-class="hover-class"
							@click="lookMoreFunc('engineering_manager_id')"
							v-if="searchListObj.engineering_manager_id.list.length != searchListObj.engineering_manager_id.max"
						>
							<text class="txt">查看更多</text>
							<u-icon name="arrow-down" color="#A1A7B3" size="12"></u-icon>
						</view>
					</view>
				</view>
			</scroll-view>
			<view class="btn-box flex ac jb">
				<u-button
					@click="reSearchValFunc"
					text="重置"
					customStyle="width: 248rpx;height: 82rpx;background: #242834;border-radius: 12rpx;font-weight: 500;font-size: 30rpx;color: #FFFFFF;"
				></u-button>
				<u-button
					@click="searchFunc"
					text="查询"
					customStyle="width: 422rpx;height: 82rpx;background: #3B75FF;border-radius: 12rpx;font-weight: 500;font-size: 30rpx;color: #FFFFFF;"
				></u-button>
			</view>
		</u-popup>
		<!-- 操作组件 -->
		<projectOperate :value.sync="per_name" :oper_item="oper_item" @submit="handleSubmit"></projectOperate>
	</view>
</template>

<script>
export default {
	name: 'projectManagement',
	props: {
		conentHeight: {
			default: 0
		},
		option: {
			type: Object,
			default: {}
		}
	},
	provide() {
		return {
			providedData: this.btns
		};
	},
	data() {
		return {
			searchShow: false,
			dataList: [],
			searchForm: {
				project_name: '',
				project_number: '',
				display_status: [],
				display_status_index: 0,
				store_type_id: '',
				user_name: '',
				user_id: '',
				engineering_manager_id: '',
				brand_id: ''
			},
			topHeight: 0,
			searchTabList: [
				{
					name: '全部',
					value: ''
				},
				{
					name: '待勘场',
					value: 15
				},
				{
					name: '待报价',
					value: 25
				},
				{
					name: '待结算',
					value: 55
				}
			],
			searchListObj: {
				brand_id: {
					list: [],
					page: 1,
					num: 5,
					max: 0
				},
				display_status: {
					list: [
						{
							label: '待启动',
							value: 10
						},
						{
							label: '待勘场',
							value: 15
						},
						{
							label: '待勘场出图',
							value: 18
						},
						{
							label: '待方案设计',
							value: 20
						},
						{
							label: '待报价',
							value: 25
						},
						{
							label: '洽谈中',
							value: 30
						},
						{
							label: '已签约',
							value: 400
						},
						{
							label: '待结算',
							value: 55
						},
						{
							label: '款项付清',
							value: 60
						},
						{
							label: '已取消',
							value: 70
						}
					],
					page: 1,
					num: 5,
					max: 0
				},
				store_type_id: {
					list: [],
					page: 1,
					num: 5,
					max: 0
				},
				user_name: {
					list: [],
					page: 1,
					num: 5,
					max: 0
				},
				engineering_manager_id: {
					list: [],
					page: 1,
					num: 5,
					max: 0
				}
			},
			per_arr: [], //权限列表
			// 操作按钮
			btns: [
				{
					per_name: 'projects_chooseSurveySite',
					state: 1010,
					name: '项目启动'
				},
				{
					per_name: 'projects_confirmIsChangeItem',
					state: 1125,
					name: '发起结算单'
				},
				{
					per_name: 'projects_assignAccountManager',
					state: 1000,
					name: '分配客户经理'
				},
				{
					per_name: 'project_sqbj',
					state: 1065,
					name: '申请报价'
				},
				{
					per_name: 'project_dkbj',
					state: 1095,
					name: '对客报价'
				},
				{
					per_name: 'projects_updProject',
					func: (item) => {
						if (item.status > 1000) {
							return true;
						} else {
							return false;
						}
					},
					name: '项目完善'
				},
				{
					per_name: 'projects_reQuote',
					func: (item) => {
						if (item.status == 1095 || item.status == 1100) {
							return true;
						} else {
							return false;
						}
					},
					name: '重新报价'
				},
				{
					per_name: 'projects_reSettlement',
					func: (item) => {
						if (item.status == 1140 || item.status == 1145) {
							return true;
						} else {
							return false;
						}
					},
					name: '重新结算'
				},
				{
					per_name: 'common_updProjectLeader',
					func: (item) => {
						if (item.account_manager_name && item.status != 1150) {
							return true;
						} else {
							return false;
						}
					},
					name: '更换客户经理'
				},
				{
					per_name: 'projects_projectRollback',
					func: (item) => {
						if (item.status != 1500 || item.status != 1150) {
							return true;
						} else {
							return false;
						}
					},
					name: '项目回退'
				},
				{
					per_name: 'projects_projectCancellation',
					func: (item) => {
						if (item.status != 1500) {
							return true;
						} else {
							return false;
						}
					},
					name: '项目取消'
				},
				{
					per_name: 'projects_delProject',
					state: 1500,
					name: '删除'
				}
			],
			// 操作相关
			per_name: '',
			oper_item: {},
			STATUS_CONSTANTS: {
				SIGNED: 400, // 已签约状态
				SIGNED_SUB_STATUSES: [40, 42, 45, 50] // 已签约的子状态
			}
		};
	},
	mounted() {
		this.getBrandList();
		this.getStoreTypeList();
		this.getCustomer();
		this.getEngineeringManager();
		this.getHeight();
		// 获取权限
		this.$Api
			.getHtmlAuthority({
				path: '/projectManagement'
			})
			.then((res) => {
				console.log(res, 'getHtmlAuthority');
				if (res.code == 200) {
					this.per_arr = res.data.permission;
				}
			});
	},
	watch: {},
	methods: {
		// 刷新修改当前操作item
		refreshItemFunc() {
			console.log('刷新当前数据');
			let oper_item = this.oper_item;
			let index = this.dataList.findIndex((item) => {
				return item.id == oper_item.id;
			});
			if (index == -1) return;
			this.$Apipc
				.getProjectDetails({
					project_id: oper_item.id
				})
				.then((res) => {
					console.log(res, '项目详情');
					if (res.code == 200) {
						res.data.user_name = res.data.customer_name;
						res.data.store_type_name = res.data.store_type_name.split('(')[0];
						this.dataList[index] = res.data;
						this.dataList.splice(0, 0);
					}
				});
		},
		// 操作反馈
		handleSubmit(e) {
			if (e == 'projects_delProject') {
				this.searchFunc();
				return;
			}
			this.refreshItemFunc();
		},
		// 操作事件
		btnsChange(e) {
			console.log(e);
			this.per_name = e.per_name;
			this.oper_item = e.item;
		},
		refresh() {
			this.dataList = [];
		},
		// 重置弹窗筛选项
		reSearchValFunc() {
			this.searchForm = {
				project_name: '',
				project_number: '',
				display_status: [],
				display_status_index: 0,
				store_type_id: '',
				user_name: '',
				engineering_manager_id: '',
				brand_id: ''
			};
			this.$nextTick(() => {
				this.searchFunc();
			});
		},
		// 刷新列表
		searchFunc() {
			this.$refs.paging.reload();
			this.searchShow = false;
		},
		getHeight() {
			// 创建节点查询
			let that = this;
			const systemInfo = uni.getSystemInfoSync();
			const query = uni.createSelectorQuery().in(that);
			query.select('.top-height').boundingClientRect();
			query.exec((res) => {
				that.topHeight = res[0].height + systemInfo.statusBarHeight + 20;
			});
		},
		// 去详情
		navToDetailFunc(item) {
			this.oper_item = item;
			uni.navigateTo({
				url: '/pagesB/projectDetail/projectDetail?id=' + item.id
			});
		},
		queryList(page, num) {
			this.saleProjectList(page, num);
		},
		// 添加项目
		navToAddFunc() {
			uni.navigateTo({
				url: '/pagesC/projectManagement/addProject/addProject'
			});
		},
		// 项目列表
		saleProjectList(page, num) {
			uni.showLoading({
				mask: true
			});
			let searchForm = this.searchForm;
			this.$Apipc
				.saleProjectList({
					page,
					num,
					to_do: 0,
					project_name: searchForm.project_name,
					project_number: searchForm.project_number,
					display_status: searchForm.display_status[0] == this.STATUS_CONSTANTS.SIGNED ? this.STATUS_CONSTANTS.SIGNED_SUB_STATUSES : searchForm.display_status,
					store_type_id: searchForm.store_type_id,
					user_name: searchForm.user_name,
					engineering_manager_id: searchForm.engineering_manager_id,
					brand_id: searchForm.brand_id
				})
				.then((res) => {
					uni.hideLoading();
					console.log(res, '项目列表');
					if (res.code == 200) {
						this.$refs.paging.complete(res.data.list);
					} else {
						this.$refs.paging.complete([]);
					}
				});
		},
		// 品牌列表
		getBrandList() {
			this.$Apipc
				.getBrandList({
					page: this.searchListObj.brand_id.page,
					num: this.searchListObj.brand_id.num
				})
				.then((res) => {
					console.log(res, '品牌列表');
					if (res.code == 200) {
						if (this.searchListObj.brand_id.page == 1) {
							this.searchListObj.brand_id.list = [];
						}
						this.searchListObj.brand_id.list = [...this.searchListObj.brand_id.list, ...res.data.list];
						this.searchListObj.brand_id.max = res.data.max;
					}
				});
		},
		// 弹窗筛选项
		searchSelectFunc(type, item) {
			console.log(type, item);
			switch (type) {
				case 'brand_id':
					this.searchForm[type] = this.searchForm[type] == item.id ? '' : item.id;
					break;
				case 'display_status':
					let blo = this.searchForm[type].indexOf(item.value);
					if (blo != -1) {
						this.searchForm[type].splice(blo, 1);
					} else {
						this.searchForm[type].push(item.value);
					}
					break;
				case 'store_type_id':
					this.searchForm[type] = this.searchForm[type] == item.id ? '' : item.id;
					break;
				case 'user_name':
					this.searchForm[type] = this.searchForm[type] == item.name ? '' : item.name;
					this.searchForm.user_id = this.searchForm.user_id == item.id ? '' : item.id;
					break;
				case 'engineering_manager_id':
					this.searchForm[type] = this.searchForm[type] == item.id ? '' : item.id;
					break;
				default:
			}
		},
		// 弹窗筛选项查看更多
		lookMoreFunc(type) {
			switch (type) {
				case 'brand_id':
					this.searchListObj.brand_id.page += 1;
					this.getBrandList();
					break;
				case 'display_status':
					this.searchListObj.display_status.num = 99;
					break;
				case 'store_type_id':
					this.searchListObj.store_type_id.page += 1;
					this.getStoreTypeList();
					break;
				case 'user_name':
					this.searchListObj.user_name.page += 1;
					this.getCustomer();
					break;
				case 'engineering_manager_id':
					this.searchListObj.engineering_manager_id.page += 1;
					this.getEngineeringManager();
					break;
				default:
			}
		},
		// 弹窗筛选项列表收起
		retractFunc(type) {
			switch (type) {
				case 'brand_id':
					this.searchListObj.brand_id.page = 1;
					this.getBrandList();
					break;
				case 'display_status':
					this.searchListObj.display_status.num = 5;
					break;
				case 'store_type_id':
					this.searchListObj.store_type_id.page = 1;
					this.getStoreTypeList();
					break;
				case 'user_name':
					this.searchListObj.user_name.page = 1;
					this.getCustomer();
					break;
				case 'engineering_manager_id':
					this.searchListObj.engineering_manager_id.page = 1;
					this.getEngineeringManager();
					break;
				default:
			}
		},
		// 门店类型列表(项目类型)
		getStoreTypeList() {
			this.$Apipc
				.getStoreTypeList({
					page: this.searchListObj.store_type_id.page,
					num: this.searchListObj.store_type_id.num
				})
				.then((res) => {
					console.log(res, '门店类型列表');
					if (res.code == 200) {
						if (this.searchListObj.store_type_id.page == 1) {
							this.searchListObj.store_type_id.list = [];
						}
						this.searchListObj.store_type_id.list = [...this.searchListObj.store_type_id.list, ...res.data.list];
						this.searchListObj.store_type_id.max = res.data.max;
					}
				});
		},
		// 客户
		getCustomer() {
			var obj = {
				page: this.searchListObj.user_name.page,
				num: this.searchListObj.user_name.num,
				keyword: '',
				province_id: '',
				city_id: '',
				county_id: '',
				identity: 4
			};
			this.$Apipc
				.getUserList(obj)
				.then((res) => {
					console.log(res, '客户');
					if (res.code == 200) {
						if (this.searchListObj.user_name.page == 1) {
							this.searchListObj.user_name.list = [];
						}
						this.searchListObj.user_name.list = [...this.searchListObj.user_name.list, ...res.data.list];
						this.searchListObj.user_name.max = res.data.max;
					}
				})
				.catch((err) => {});
		},
		// 顶部tab快捷搜索
		searchTabClick(e) {
			console.log(e);
			this.searchForm.display_status = e.value;
			this.searchForm.display_status_index = e.index;
			this.$refs.paging.reload();
		},
		// 工程经理
		getEngineeringManager() {
			var obj = {
				page: this.searchListObj.engineering_manager_id.page,
				num: this.searchListObj.engineering_manager_id.num,
				keyword: '',
				province_id: '',
				city_id: '',
				county_id: '',
				identity: 2,
				position_id_arr: [7]
			};
			this.$Apipc
				.getAdminList(obj)
				.then((res) => {
					console.log(res, '工程经理');
					if (res.code == 200) {
						if (this.searchListObj.engineering_manager_id.page == 1) {
							this.searchListObj.engineering_manager_id.list = [];
						}
						this.searchListObj.engineering_manager_id.list = [...this.searchListObj.engineering_manager_id.list, ...res.data.list];
						this.searchListObj.engineering_manager_id.max = res.data.max;
					}
				})
				.catch((err) => {});
		}
	}
};
</script>

<style lang="scss"></style>
